##############################################################
## MOD Title: Effects Store for Shop 3
## MOD Author: Thoul < thoul@phpbbsmith.com > (Jeremy Rogers) http://www.phpbbsmith.com
## MOD Description: Adds a special effects store to Shop 3.
## MOD Version: 1.3.0
##
## Installation Level: Intermediate
## Installation Time: 10 Minutes
## Files To Edit:
##		admin/admin_shop.php,
##		privmsg.php
##		viewtopic.php,
##		includes/usercp_register.php,
##		includes/usercp_viewprofile.php,
##		templates/subSilver/profile_add_body.tpl,
##		templates/subSilver/profile_view_body.tpl,
##		templates/subSilver/viewtopic_body.tpl
## Included Files:
##		install.php,
##		shop_effects.php,
##		language/lang_english/lang_effects.php,
##		mods/shopaddons/effects.php,
##		mods/shopaddons/colors.js,
##		templates/subSilver/admin/shop_effects_config.tpl,
##		templates/subSilver/shop/effects.tpl,
##		templates/subSilver/shop/personal.tpl
## License: contrib/license.txt GNU General Public License v2
##############################################################
## Author Notes:
##
## This modification adds a special effects shop to Zarath's Shop 3.  If you've
## used the effects shop in Shop 2.x, you'll find that this one is laid out 
## quite differently, but has most of the same features.
##
## To edit the settings of the special effects shop, go to the phpBB Admin
## Panel and select Shop Settings from the menu.  At the bottom of this page
## is a drop down list of shops in your forum.  Select Special Effects from
## the list and click the edit button.  If you'd prefer the Shop 2.x style of
## having a button in the Shop Settings that launches the effects shop editor,
## there is an add-on for that in the contrib/ directory of this download.
##
## Before installing this modification, you should have a working install of
## Shop 3 and a Points or Cash modification.  This mod is NOT compatible with
## Shop 2.x.
##
## On some templates, the glow and shadow effects may not work in Internet
## Explorer browsers.  If you encounter such behavior, please see the 
## contrib/fix_doctype.txt for further instructions.  This generally isn't need
## on subSilver.
##
## Some other hacks that alter the poster usernames in topics may cause strange
## name displays when used with this hack.  Advanced Quick Reply is known to do
## this, as are a few others.  If this happens to you, check the
## contrib/known_issues.txt file for a link that will tell you how to fix it.
##
##############################################################
## BEFORE FOLLOWING THESE INSTRUCTIONS, YOU SHOULD BACK UP ALL RELATED FILES.
##############################################################

#
#-----[ COPY ]------------------------------------------
#

root/install.php to install.php
root/shop_effects.php to shop_effects.php
root/mods/shopaddons/effects.php to mods/shopaddons/effects.php
root/mods/shopaddons/colors.js to mods/shopaddons/colors.js
root/language/lang_english/lang_effects.php to language/lang_english/lang_effects.php
root/templates/subSilver/admin/shop_effects_config.tpl to templates/subSilver/admin/shop_effects_config.tpl
root/templates/subSilver/shop/effects.tpl to templates/subSilver/shop/effects.tpl

#
#-----[ COPY ]------------------------------------------
#
# You may already have this file from another modification and may have edited
# it for another modification.  If so, skip this step.
#

root/templates/subSilver/shop/personal.tpl to templates/subSilver/shop/personal.tpl

#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#

Run install.php by visiting it in your web browser, for example
http://www.yoursite.com/phpBB2/install.php
This will install the database portions of the hack. If you prefer to run the
queries manually, check the contrib/ directory for install.sql.

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_shop.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store for Shop 3

#
#-----[ FIND ]------------------------------------------
#

if ( isset($HTTP_GET_VARS['action']) || isset($HTTP_POST_VARS['action']) ) { $action = ( isset($HTTP_POST_VARS['action']) ) ? $HTTP_POST_VARS['action'] : $HTTP_GET_VARS['action']; }
else { $action = ''; }
//end check

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/shopaddons/effects.' . $phpEx);
$effects_admin->check_effects_edit($action);
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#
# This line is a little different in earlier versions of Shop 3.
#

else { message_die(GENERAL_MESSAGE, $lang['invalid_command']); }

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
elseif ( $action == 'effects' )
{
	$effects_admin->show_effects_admin();
}
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
privmsg.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store for Shop 3

#
#-----[ FIND ]------------------------------------------
#

include($phpbb_root_path . 'includes/functions_post.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/shopaddons/effects.' . $phpEx);
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

	else
	{
		$user_sig = '';
	}

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
	if( !$effects->check_privilege($privmsg['privmsgs_from_userid'], 'signature') )
	{
		$user_sig = '';
	}
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		'YIM_IMG' => $yim_img,
		'YIM' => $yim)
	);

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
	$effects->pm_check();
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store for Shop 3

#
#-----[ FIND ]------------------------------------------
#

include($phpbb_root_path . 'includes/bbcode.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/shopaddons/effects.' . $phpEx);
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

	$template->assign_block_vars('postrow', array(

#
#-----[ REPLACE WITH ]------------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added: 
	$shop_effects = $effects->post_check($postrow[$i]);
//		Added: array_merge(
//		Original phpBB Code:
	$template->assign_block_vars('postrow', array(
*/
	$shop_effects = $effects->post_check($postrow[$i]);
	$template->assign_block_vars('postrow', array_merge(array(
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		'U_POST_ID' => $postrow[$i]['post_id'])

#
#-----[ REPLACE WITH ]------------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added: , $shop_effects)
//		Original phpBB Code:
		'U_POST_ID' => $postrow[$i]['post_id'])
*/
		'U_POST_ID' => $postrow[$i]['post_id']), $shop_effects)
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store for Shop 3

#
#-----[ FIND ]--------------------------------------
#

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
	exit;
}

#
#-----[ AFTER, ADD ]--------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/shopaddons/effects.' . $phpEx);
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]--------------------------------------
#

	if ( $board_config['allow_namechange'] || $mode == 'register' )

#
#-----[ BEFORE, ADD ]--------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added:  ($board_config['allow_namechange'] && $effects->check_namechange($userdata))
//		Original phpBB Code:
	if ( $board_config['allow_namechange'] || $mode == 'register' )
*/

#
#-----[ IN-LINE FIND ]--------------------------------------
#

$board_config['allow_namechange']

#
#-----[ IN-LINE REPLACE WITH ]--------------------------------------
#

($board_config['allow_namechange'] && $effects->check_namechange($userdata))

#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]--------------------------------------
#

	if ( ($mode == 'register') || ($board_config['allow_namechange']) )

#
#-----[ BEFORE, ADD ]--------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added:   && $effects->check_namechange($userdata)
//		Original phpBB Code:
	if ( ($mode == 'register') || ($board_config['allow_namechange']) )
*/

#
#-----[ IN-LINE FIND ]--------------------------------------
#

$board_config['allow_namechange']

#
#-----[ IN-LINE AFTER, ADD ]--------------------------------------
#

 && $effects->check_namechange($userdata)

#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )

#
#-----[ BEFORE, ADD ]------------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//		Added:  $effect_check['avatar'] && 
//		Original phpBB Code:
		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
*/
		$effect_check = $effects->profile_edit_check($userdata);

#
#-----[ IN-LINE FIND ]------------------------------------------
#

$userdata['user_allowavatar']

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#

$effect_check['avatar'] && 

#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store for Shop 3

#
#-----[ FIND ]------------------------------------------
#

$template->pparse('body');

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store for Shop 3 - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/shopaddons/effects.' . $phpEx);
$effects->profile_check($profiledata);
//
// Effects Store for Shop 3 - End Code Alteration
//------------------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]------------------------------------------
#
# First line of the file.
#

<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- This file modified for Effects Store for Shop 3 -->

#
#-----[ FIND ]------------------------------------------
#

	<tr> 
	  <td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
	  <td class="row2"> 
		<textarea name="signature" style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</textarea>
	  </td>
	</tr>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- BEGIN effects_signature -->

#
#-----[ AFTER, ADD ]------------------------------------------
#

<!-- END effects_signature -->

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
# First line of the file.
#

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- This file modified for Effects Store for Shop 3 -->

#
#-----[ FIND ]------------------------------------------
#

{POSTER_RANK}

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

<br />{POSTER_EFFECT_TITLE}


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl

#
#-----[ FIND ]------------------------------------------
#
# First line of the file.
#

<table width="100%" cellspacing="2" cellpadding="2" border="0">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- This file modified for Effects Store for Shop 3 -->

#
#-----[ FIND ]------------------------------------------
#

{postrow.POSTER_RANK}

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

<br />{postrow.POSTER_EFFECT_TITLE}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM